// 引入封装好的axios
import request from '@/utils/request'

/**
 * 根据查询关键字搜索小区
 * @param {Object} params 查询关键字和城市id
 * @returns Promise
 */
export const searchCommunityApi = (params) => {
  return request({
    url: '/area/community',
    params
  })
}

export function publishHouseImage(file) {
  return request({
    url: '/houses/image',
    data: file,
    method: 'POST'
  })
}

/**
 * 发布房屋
 * @param {Object} data 发布房屋所需得条件
 * @returns Promise
 */
export const PublishListingsApi = (data) => {
  return request({
    url: '/user/houses',
    method: 'POST',
    data
  })
}

/**
 *查看自己发布的房源
 * @param {*} 发一个请求头参数，已在拦截器中设置
 * @returns Promise
 */
export function getUserMyRentHouseApi() {
  return request({
    url: '/user/houses'
  })
}
